package cn.jsj.user.manager;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 添加行政人员处理类
 * @author LI
 *
 */
 public class AddAdminPersonInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("添加行政人员");

		 //新建行政人员对象
		 cn.jsj.pojo.TblAdminPersonnel tap=new cn.jsj.pojo.TblAdminPersonnel();

		 //赋值
		  tap.setAdminPersonEmail(request.getParameter("aadminemail").trim());
		  tap.setAdminPersonName(request.getParameter("aadminpersonname").trim());
		  tap.setAdminPersonPhone(request.getParameter("aadminphone").trim());
		  tap.setAdminPersonPosition(request.getParameter("aadminposition").trim());
		  tap.setAdminPersonSex(request.getParameter("sex"));
		  tap.setBirthTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("aadminbirthtime").trim()));
		  tap.setDeleteLabel(0);
		  tap.setEducationalLevel(request.getParameter("aadmineducationallevel").trim());
		  tap.setGraduateSchool(request.getParameter("aadmingraduateschool").trim());
		  tap.setIdentityNumber(request.getParameter("aadminidentitynumber").trim());
		  tap.setLawyerPwd("111111");
		  tap.setPoliticalStatus(request.getParameter("aadminpoliticalstatus").trim());
		  tap.setPopedomLevel(Integer.parseInt(request.getParameter("adminpopedom").trim()));
		  tap.setPracAgreement(Integer.parseInt(request.getParameter("adminagreement").trim()));

		  //赋值完成
		  cn.jsj.utils.SysLogger.PrintInfo("赋值完成");

		  //保存
		  cn.jsj.dao.TblAdminPersonnelDAO tapd=new cn.jsj.dao.TblAdminPersonnelDAO();
		  int saveResult=tapd.saveAdminPerson(tap);

		//输出流
			 java.io.PrintWriter out=response.getWriter();
			 if(saveResult==1){
				 out.println("{message:'添加成功！'}");
			 }else{
				 out.println("{message:'添加失败！'}");
			 }

			 out.flush();
			 out.close();
	 }
}